import { useSelector } from "react-redux";
import { StateType } from '../store/index.ts'
import { ComponentsStateType } from "../store/componentsReducer/index.ts";

const useGetComponentInfo = ()=>{
    const components = useSelector<StateType>(state => state.components.present) as ComponentsStateType
    const { componentList = [],selectedId,copiedComponent } = components
    const selectedComponent = componentList.find(c=> c.fe_id === selectedId)
    // console.log('selectedComponent',selectedComponent)
    return {
        componentList,
        selectedId,
        selectedComponent,
        copiedComponent
    }
}

export default useGetComponentInfo